package com.hitqz.robot.camera.configure;

import com.hitqz.robot.camera.EquipmentFactory;
import com.hitqz.robot.camera.IEquipmentService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author :   kehanjiang
 * @date :   2021/12/14  13:37
 */
@Configuration
public class EquipmentAutoConfiguration {
    @Bean
    @ConfigurationProperties(prefix = "camera")
    public CameraProperties cameraProperties() {
        return new CameraProperties();
    }

    @Bean
    @ConditionalOnBean(CameraProperties.class)
    public EquipmentFactory equipmentFactory(List<IEquipmentService> equipmentServices, CameraProperties properties) {
        return new EquipmentFactory(equipmentServices,properties);
    }
}
